﻿namespace KinonekoSoftware.Platform
{
#if WINDOWS
    public class BindingProxy : Freezable
    {
        protected override Freezable CreateInstanceCore()
        {
            return new BindingProxy();
        }


        public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register(
            nameof(ViewModel),
            typeof(object),
            typeof(BindingProxy),
            new PropertyMetadata(default(object)));

        public object ViewModel
        {
            get => GetValue(ViewModelProperty);
            set => SetValue(ViewModelProperty, value);
        }
    }


    public class BindingProxy<T> : Freezable
    {
        
        protected override Freezable CreateInstanceCore()
        {
            return new BindingProxy<T>();
        }


        public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register(
            nameof(ViewModel),
            typeof(T),
            typeof(BindingProxy<T>),
            new PropertyMetadata(default(T)));

        public T ViewModel
        {
            get => (T)GetValue(ViewModelProperty);
            set => SetValue(ViewModelProperty, value);
        }
    }

#else

    public class BindingProxy
    {
        public object ViewModel { get; set; }
    }


    public class BindingProxy<T>
    {
        public T ViewModel { get; set; }
    }

#endif
}